<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-collapse [lvType]="'simple'">
    <lv-collapse-panel [lvTitle]="'common_advanced_label'|i18n" lvExpanded>
        <lv-form [formGroup]="formGroup" [lvLabelColon]="isSlaDetail">
            <aui-specify-destination-location [formGroup]="formGroup" [data]="data" [isSlaDetail]="isSlaDetail"
                [action]="action" [isRetry]="isRetry" [isUsed]="isUsed" (isDisableQos)="storageTypeChange($event)">
            </aui-specify-destination-location>
            <!-- 通用压缩 -->
            <lv-form-item *ngIf="appUtilsService.isDistributed">
                <lv-form-label> {{ 'protection_common_deduption_label' | i18n }} </lv-form-label>
                <lv-form-control>
                    <ng-container *ngIf="!isSlaDetail">
                        <lv-switch formControlName="enable_deduption_compression"></lv-switch>
                    </ng-container>
                    <ng-container *ngIf="isSlaDetail">
                        {{formGroup.value.enable_deduption_compression | textMap: 'Switch_Sla_Info_Status'}}
                    </ng-container>
                </lv-form-control>
            </lv-form-item>
             <!-- 任务超过时间窗告警 -->
             <lv-form-item>
                <lv-form-label>
                    {{'protection_job_timeout_alarm_label' | i18n}}
                    <i lv-icon="aui-icon-help" lv-tooltip="{{'protection_job_timeout_alarm_help_label' | i18n}}"
                        lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint"
                        lvColorState='true'></i>
                </lv-form-label>
                <lv-form-control>
                    <ng-container *ngIf="!isSlaDetail">
                        <lv-switch formControlName="alarm_over_time_window"></lv-switch>
                    </ng-container>
                    <ng-container *ngIf="isSlaDetail">
                        {{formGroup.value.alarm_over_time_window | textMap: 'Switch_Sla_Info_Status'}}
                    </ng-container>
                </lv-form-control>
            </lv-form-item>
            <!-- 任务失败告警 -->
            <lv-form-item>
                <lv-form-label>
                    {{'protection_job_failed_alarm_label' | i18n}}
                    <i lv-icon="aui-icon-help" lv-tooltip="{{'protection_alarm_after_failure_help_label' | i18n}}"
                        lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint"
                        lvColorState='true'></i>
                </lv-form-label>
                <lv-form-control>
                    <ng-container *ngIf="!isSlaDetail">
                        <lv-switch formControlName="alarm_after_failure"></lv-switch>
                    </ng-container>
                    <ng-container *ngIf="isSlaDetail">
                        {{formGroup.value.alarm_after_failure | textMap: 'Switch_Sla_Info_Status'}}
                    </ng-container>
                </lv-form-control>
            </lv-form-item>
            <ng-container *ngIf="!isSlaDetail">
                <lv-form-item>
                    <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                    <lv-form-control>
                        <lv-switch formControlName="auto_retry"></lv-switch>
                        <ng-container *ngIf="formGroup.value.auto_retry">
                            <div class="aui-gutter-column-md"></div>
                            <lv-form-label lvRequired>
                                {{'common_retry_times_label' | i18n}}
                            </lv-form-label>
                            <lv-form-control [lvErrorTip]="retryTimesErrorTip" class="groupInControl">
                                <lv-group lvGutter='8px' class="lv-group-flex-start">
                                    <lv-group>
                                        <input lv-input formControlName="auto_retry_times" type="text" placeholder="1~5"
                                            class="backup-for-text" />
                                    </lv-group>
                                    <lv-group>
                                        <span class="configform-constraint">{{'common_times_label' | i18n}}</span>
                                    </lv-group>
                                </lv-group>
                            </lv-form-control>
                            <div class="aui-gutter-column-md"></div>
                            <lv-form-label lvRequired>
                                {{'common_waiting_time_label' | i18n}}
                            </lv-form-label>
                            <lv-form-control [lvErrorTip]="waitTimesErrorTip" class="groupInControl">
                                <lv-group lvGutter='8px' class="lv-group-flex-start">
                                    <lv-group>
                                        <input lv-input formControlName="auto_retry_wait_minutes" type="text"
                                            placeholder="1~30" class="backup-for-text" />
                                    </lv-group>
                                    <lv-group>
                                        <span class="configform-constraint">{{'common_minutes_label' | i18n}}</span>
                                    </lv-group>
                                </lv-group>
                            </lv-form-control>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
            </ng-container>
            <ng-container *ngIf="isSlaDetail">
                <lv-form-item>
                    <lv-form-label>{{'protection_auto_retry_label' | i18n}}</lv-form-label>
                    <lv-form-control>
                        <ng-container *ngIf="!formGroup.value.auto_retry">
                            {{formGroup.value.auto_retry | textMap: 'Switch_Sla_Info_Status'}}
                        </ng-container>
                        <ng-container *ngIf="formGroup.value.auto_retry">
                            <ng-container *ngIf="i18n.isEn">
                                {{'common_retry_times_label' | i18n: []:
                                true}}{{formGroup.value.auto_retry_times}} {{'common_times_label' |
                                i18n}}{{'common_comma_label'|i18n}}
                                {{'common_waiting_time_label' | i18n: []:
                                true}}{{formGroup.value.auto_retry_wait_minutes}} {{'common_minutes_label' | i18n}}
                            </ng-container>
                            <ng-container *ngIf="!i18n.isEn">
                                {{'common_retry_times_label' | i18n: []:
                                true}}{{formGroup.value.auto_retry_times}}{{'common_times_label' |
                                i18n}}{{'common_comma_label'|i18n}}
                                {{'common_waiting_time_label' | i18n: []:
                                true}}{{formGroup.value.auto_retry_wait_minutes}}{{'common_minutes_label' | i18n}}
                            </ng-container>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
            </ng-container>
        </lv-form>
    </lv-collapse-panel>
</lv-collapse>
